Skip to content

docs: add ClickHouse analytics blog post - #686

Merged
berry-13 merged 6 commits into
mainfrom
blog/plausible-clickhouse-migration
Jul 26, 2026
Merged

docs: add ClickHouse analytics blog post#686
berry-13 merged 6 commits into
mainfrom
blog/plausible-clickhouse-migration

Conversation

@berry-13

Copy link
Copy Markdown
Member

What

Adds a blog post on how the LibreChat website's analytics are built: Plausible for the privacy-friendly front end, ClickHouse as the storage engine underneath, and a walkthrough of the recent move between ClickHouse Cloud clusters.

The post lives at /blog/2026-06-25_clickhouse-analytics and is written first-person to match the existing ZimaCube post.

New components

  • AnalyticsArchitecture — a theme-aware, accessible data-flow diagram (browser → Plausible CE → ClickHouse Cloud, with Postgres and the Core Web Vitals store as satellites). Pure layout, no image asset.
  • SiteStats — an async server component. When PLAUSIBLE_STATS_API_KEY is set it queries the Plausible Stats API v2 at request time (cached one hour) and shows real visitor/pageview/visit numbers. Without the key it renders a dated static snapshot, so local dev, previews, and forks always build. The key stays server-side and never reaches the client.

Both are registered in lib/mdx-components.tsx. A 1200×630 cover image is included.

Enabling live stats (optional)

Env var Required Default Purpose
PLAUSIBLE_STATS_API_KEY for live data none Plausible Stats API key (Bearer). Falls back to the snapshot when unset.
PLAUSIBLE_SITE_ID no librechat.ai Site to query.
PLAUSIBLE_BASE_URL no https://plausible.librechat.ai Plausible instance the API calls hit.

Testing

  • pnpm typecheck and pnpm lint pass.
  • Post renders 200 with both components; verified visually in light and dark mode, plus the cover image at the top of the post.
  • The stats widget was verified on its snapshot fallback path (no API key in dev).

Note

No connection strings, hostnames, IPs, or credentials from the actual migration appear in the post or anywhere in this change.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
librechat-ai Ready Ready Preview, Comment Jul 26, 2026 8:26pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 826f8383d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread content/blog/2026-06-25_clickhouse-analytics.mdx Outdated
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1996c46df4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread content/blog/2026-07-26_clickhouse-analytics.mdx Outdated
Comment thread components/blog/SiteStats.tsx
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d92254e45d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/blog/[slug]/page.tsx
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@berry-13

Copy link
Copy Markdown
Member Author

@codex review

berry-13 added 5 commits July 26, 2026 20:43
A first-person post on how librechat.ai's analytics run on Plausible backed by ClickHouse, including the recent cloud-to-cloud cluster move.

Adds two reusable blog components: AnalyticsArchitecture, a theme-aware data-flow diagram, and SiteStats, a server component that reads live numbers from the Plausible Stats API when PLAUSIBLE_STATS_API_KEY is set and falls back to a static snapshot otherwise. Includes the cover image and registers both components in mdx-components.
…ents

Replace the cluster-migration walkthrough with the part readers actually care about: pointing a LibreChat agent at the ClickHouse data and asking it questions in plain English, the privacy stance behind it, and the ClickHouse partnership tie-in. The migration drops to a single line. Adds a prompts appendix and bumps Plausible to v3.2.1.
…gures

Adds two screenshots from the actual LibreChat agent session: the tool calls and data provenance, and the Key Insights answer. Corrects every number in the summary table against that run (Wednesday not Monday, 21% weekend share, Docker at 4.4x npm, and so on), and covers the engagement_time data-quality problem the agent flagged on its own.

Redates the post to its publication date so it matches the date range visible in the transcript, renaming the post and its images to suit.
The floppy-disk comparison was wrong: 28 MiB needs about twenty 1.44 MB disks, not half of one. Swapped it for a CD, which holds the dataset roughly twenty times over.

Blog posts are prerendered from generateStaticParams, and the SiteStats fallback performs no fetch, so a post embedding it was baked at build with no revalidation and a Plausible key added later could never take effect. Sets revalidate on the blog route so those pages regenerate hourly.
The shared blog rule pins every /blog document at s-maxage=86400, so the CDN could serve day-old numbers on a post that presents them as live, regardless of how often the origin regenerated. Adds a narrower rule for those paths at s-maxage=3600 to match the route's revalidate, keeping the RSC split so flight payloads stay uncacheable.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 43007c7569

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@berry-13
berry-13 merged commit 123cfd4 into main Jul 26, 2026
5 checks passed
@berry-13
berry-13 deleted the blog/plausible-clickhouse-migration branch July 26, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant